require 'test/unit'

require 'models/game'
require 'models/region'
require 'engine/game_setup'

class TCMud
    include GameDatabaseSetup
end

class GameTest < Test::Unit::TestCase
    require 'fileutils'
    def setup
        @root_dir = ['test','game'].join(File::SEPARATOR)
        template_dir = [@root_dir,'templates'].join(File::SEPARATOR)
        region_dir = [@root_dir,'regions'].join(File::SEPARATOR)
        FileUtils.mkdir_p(@root_dir)
        FileUtils.mkdir_p(template_dir)
        FileUtils.mkdir_p(region_dir)
    end
    def test_game_can_be_saved_and_loaded
        game = Game.new
        game.oid = 1
        game.name = 'Chucho MUD'

        mud = TCMud.new
        assert_nothing_raised() {mud.save_the_game(game,@root_dir)}
        assert_equal(game,mud.load_the_game(@root_dir))
    end
end
